﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QldtSdh.BLL
{
    using DAL;
    using DAL.Models;
    using Utils;

    class BizThongBaoNCS
    {
        public static List<ThongBaoNCS> GetList()
        {
            using (var db = CEMS4UG_DHKHContext.GetContext())
            {
                return db.ThongBaoNCSDbSet.OrderByDescending(e => e.NgayThongBao).ToList();
            }
        }
        public static bool Add(ThongBaoNCS thongBao)
        {
            using (var db = CEMS4UG_DHKHContext.GetContext())
            {
                try
                {
                    thongBao.MaThongBao = Guid.NewGuid().ToString();
                    db.ThongBaoNCSDbSet.Add(thongBao);
                    db.SaveChanges();
                    return true;
                }
                catch (Exception)
                {
                    return false;
                }
            }
        }
    }
}
